const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER,
      allowNull: false,

      primaryKey: true,
      autoIncrement: true,
      comment: "ID",
      field: "id"
    },
    code: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "苗种编号",
      field: "code"
    },
    p_src_en_name: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "采购来源企业名称",
      field: "p_src_en_name"
    },
    p_src_en_code: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "厂商识别码",
      field: "p_src_en_code"
    },
    p_src_qualify: {
      type: DataTypes.STRING(50),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "质量安全评定及认证信息",
      field: "p_src_qualify"
    },
    scale: {
      type: DataTypes.STRING(20),
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "繁育规模",
      field: "scale"
    },
    time: {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue:  '',
      primaryKey: false,
      autoIncrement: false,
      comment: "繁育时间",
      field: "time"
    },
    batch_code: {
      type: DataTypes.STRING(24),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "自愈批次编号",
      field: "batch_code"
    },
    p_batch_code: {
      type: DataTypes.STRING(24),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "其母代批次编号",
      field: "p_batch_code"
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: false,

      primaryKey: false,
      autoIncrement: false,
      comment: "创建时间",
      field: "createdAt"
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: false,

      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "updatedAt"
    },
    deletedAt: {
      type: DataTypes.DATE,
      allowNull: true,

      primaryKey: false,
      autoIncrement: false,
      comment: null,
      field: "deletedAt"
    }
  };
  const options = {
    tableName: "seedling_self",
    comment: "",
    indexes: [],
    timestamps: true,
    paranoid: true
  };
  const SeedlingSelfModel = sequelize.define("seedling_self_model", attributes, options);
  return SeedlingSelfModel;
};